<template>
	<view>
		<view class="content ">
			<view class="flex-s">
				<view class="ordernavmain">
					<view class="ordereach" :class="activenav == 0 ? 'activenav':''" @click="navclick(0)">全部</view>
					<view class="ordereach" :class="activenav == 1 ? 'activenav':''" @click="navclick(1)">今天</view>
					<view class="ordereach" :class="activenav == 2 ? 'activenav':''" @click="navclick(2)">近7天</view>
					<view class="ordereach" :class="activenav == 3 ? 'activenav':''" @click="navclick(3)">近15天</view>
					<view class="ordereach" :class="activenav == 4 ? 'activenav':''" @click="navclick(4)">近30天</view>
				</view>
			</view>
		</view>
			<view class="row flex-s" v-if="userLevel==4||userLevel==3" @click="apifun.navigate('bundle/pages/lhdetail','time='+activenav)">
				<view class="" >整体营业额</view>
				<view class="">{{list.order_amount}} 元</view>
			</view>
			<view class="row flex-s" @click="apifun.navigate('bundle/pages/lhdetail','time='+activenav)">
				<view class="">支付订单数</view>
				<view class="">{{list.order_count}} 单</view>
			</view>
			<view class="row flex-s" @click="apifun.navigate('/bundle_b/pages/user_spread_order/user_spread_order?type=1&time='+activenav)">
				<view class="">待分佣</view>
				<view class="">{{list.distribution_d_count}} 元</view>
			</view>
			<view class="row flex-s" @click="apifun.navigate('/bundle_b/pages/user_spread_order/user_spread_order?type=2&time='+activenav)">
				<view class="">已分佣总额</view>
				<view class="">{{list.distribution_y_count}} 元</view>
			</view>
			<view class="row flex-s" v-if="userLevel==4">
				<view class="">预估收益</view>
				<view class="">{{list.distribution_g_count}} 元</view>
			</view>
	</view>
</template>

<script>
	import {
		ShopUserData,
	} from "@/api/user"
	export default {
		data() {
			return {
				list: [], 
				activenav: 0,
				userLevel: '',
			}
		},
		onLoad() {
			this.userLevel =uni.getStorageSync('userInfo').level
			this.getShopUserData()
		},
		methods: {
			async getShopUserData(){
				const {
					data,
					code,
					msg
				} = await ShopUserData({
					time_type:this.activenav,
				})
				if (code == 1) {
					this.list = data
				}
			},
			navclick(type) { //切换状态
			// this.downCallback()
				let that = this;
				that.activenav = type;
				that.getShopUserData() 
			},
		}
	}
</script>

<style>
	
	.row{
		background-color: #fff;
		padding: 26rpx 20rpx;
		margin: 14rpx 30rpx;
		border-radius: 14rpx;
	}
	page {
		background-color: #efefef;
		padding-bottom: 30rpx;
	}

	.content {
		background-color: #fff;
		border-radius: 12rpx;
		margin: 26rpx 20rpx 30rpx;
		padding: 26rpx;
	}

	.ordernavmain {
		/* width: 85%; */
		display: flex;
		justify-content: space-between;
	}
	.ordereach {
		position: relative;
		color: #0A0A0A;
		font-size: 28rpx;
		width: 130rpx;
		padding: 4rpx 0;
		text-align: center;
		border-radius: 40rpx;
	}

	.activenav {
		color: #fff;
		background-color: #ee434b;
	}

</style>
